package org.xiji.observer2;

import java.util.Scanner;

/**
 * 订阅者模式
 */
public class Observer2Main {
    public static void main(String[] args) {
        Teacher teacher = new Teacher();

        Student student1 = new Student("小久");
        Student student2 = new Student("张三");
        Student student3 = new Student("惜己");

        teacher.register(student1);
        teacher.register(student2);
        teacher.register(student3);

        //创建io流
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请输入通知内容：");
            String message = scanner.nextLine();
            teacher.setMessage(message);

        }


    }
}
